<template>
	<div class="menu w-full h-full box-border">
    <div class="p-4 text-red-600">
      menu 123

      {{ userinfo.name }}

      <br/>
      {{ user.name }}
      <br/>
      {{ car.name }}
      <el-button @click="handle">获取</el-button>
      <el-button @click="asy">同步</el-button>
    </div>
  </div>
</template>
<script>
export default {
	name: 'menu',
	data() {
		return {
      userinfo:{
        name:"章北海"
      }
    }
	},
  created() {
    console.log(this.$store);
  },
  // 里边数据计算 走内存的 可以理解成没有声明周期的  剩性能 
  computed:{
    user(){
      return this.$store.state.user.userinfo
    },
    car(){
      return this.$store.state.car.carinfo
    }
  },
  methods: {
    handle(){
      this.userinfo.name = "褚岩"
    },
    asy(){
      this.$store.commit('user/setUserInfo', {name:"褚岩"})
    }
  },
}
</script>
<style lang="less">
@import "~@/index.less";
.menu{
  
}
</style>